/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// peg.hpp- global include file, required by all modules using PEG.
//
// Author: Kenneth G. Maxwell
//
// Copyright (c) 1997-2008 Swell Software, Inc.
//              All Rights Reserved.
//
// Unauthorized redistribution of this source code, in whole or part,
// without the express written permission of Swell Software, Inc.
// is strictly prohibited.
//
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/



#ifndef _PEGDEFS_
#define _PEGDEFS_

#if defined(WINDOW_BUILDER)
#include "pconfig.wb"
#else
#include "pconfig.hpp"      // Pull in user configuration settings
#endif

/*--------------------------------------------------------------------------*/
// configuration error checks for PEG Pro only functions
/*--------------------------------------------------------------------------*/

#if defined(PEG_PRO) || defined(WINDOW_BUILDER)

#define PEG_TRUE_ALIAS

#if defined(PEG_RUNTIME_RESOURCES)

#if !defined(PEG_FILE_CLASS)
#error Configuration Error- PEG File I/O must be configured for RUNTIME_RESOURCES
#endif  // peg file class

#if !defined(PEG_UNZIP)
#error Configuration Error- PEG_UNZIP required for RUNTIME_RESOURCES
#endif  // unzip

#endif  // runtime resources

#else   // PEG_PRO is not defined

#if defined(PEG_MULT_HARD_SURFACES)
#error Configuration Error- Hardware Surfaces are only supported with PEG Pro library.
#endif

#if defined(PEG_FREETYPE_SUPPORT)
#error Configuration Error- Freetype font rendering only supported under PEG Pro
#endif

#if defined(PEG_BITMAP_ROTATE)
#error Configuration Error- Bitmap rotation only supported under PEG Pro
#endif

#endif   // PEG PRO

/*--------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------

    You should NOT have to make any changes below to build for your
    target.

----------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

// Some options are dependant, make sure the right options are turned on
// to support dependant options:

#ifdef PEG_HMI_GADGETS
#ifndef PEG_FULL_GRAPHICS
#define PEG_FULL_GRAPHICS
#endif
#endif


#if defined(PEG_MULT_SOFT_SURFACES) || defined(PEG_MULT_HARD_SURFACES)
#define PEG_MULTIPLE_SURFACES
#endif

#ifdef PEG_AWT_SUPPORT
#ifndef PEG_FULL_GRAPHICS
#define PEG_FULL_GRAPHICS
#endif
#ifndef PEG_FP_GRAPHICS
#define PEG_FP_GRAPHICS
#endif
#ifndef PEG_IMAGE_CONVERT
#define PEG_IMAGE_CONVERT
#endif
#ifndef PEG_IMAGE_SCALING
#define PEG_IMAGE_SCALING
#endif
#endif




#if defined(PEGSMX) && defined(WIN32)   // true for smxSim version
#define PEGWIN32
#endif

/*--------------------------------------------------------------------------*/
// Many of the provided drivers are designed for use on the x86 series.
// These map our PINB/POUTB names to whatever the compiler design requires.
// You may need to enhance this list to support other versions of these
// compilers and/or add another compiler. These macros are not used for
// drivers not intended for x86 systems.
/*--------------------------------------------------------------------------*/

#if defined (PEGONTIME)
#define POUTB(a, b) RTOut(a, b)
#define POUTW(a, b) RTOutW(a, b)
#define PINB(a) RTIn(a)

#elif defined(_KWIKPEG_)
#define POUTB(a, b) kp_out8(a, b)
#define POUTW(a, b) kp_out16(a, b)
#define PINB(a)  kp_in8(a)

#elif defined(__PARADIGM__)
#include "embedded.h"
#define POUTB(a, b) outportb(a, b)
#define POUTW(a, b) outport(a, b)
#define PINB(a)     inportb(a)

#elif defined(_MSC_VER) && !defined(PEG_PHARLAP)
#define POUTB(a, b) _outp(a, b)
#define POUTW(a, b) _outpw(a, b)
#define PINB(a) _inp(a)

#elif defined(__BORLANDC__) || defined(_WATCOMC_)
#define POUTB(a, b) outp(a, b)
#define POUTW(a, b) outpw(a, b)
#define PINB(a) inp(a)

#elif defined(CADUL)
#define POUTB(a, b) outbyte(a, b)
#define POUTW(a, b) outhword(a, b)
#define PINB(a) inbyte(a)

#elif defined(__HIGHC__)
#define POUTB(a, b) _outb(a, b)
#define POUTW(a, b) _outpw(a, b)
#define PINB(a) _inb(a)

#elif defined(LYNXPEG)
extern "C" {
void __outb(unsigned short, unsigned char);
unsigned char __inb(unsigned short);
}
#define POUTB(port, b) __outb(port, b)
#define PINB(port) __inb(port)

#elif defined(LINUXPEG)
#include <unistd.h>
#include <sys/io.h>
#define POUTB(port, a) outb((unsigned char) a, port)
#define PINB(port) inb(port)

#elif defined(NETBSDPEG)
#include <sys/types.h>
#include <i386/pio.h>
#define POUTB(port, a) outb(port, a)
#define PINB(port) inb(port)

#elif defined(ECOSPEG)
#include <cyg/hal/hal_io.h>
#define POUTB(port, a) HAL_WRITE_UINT8(port, a)
#define PINB(port) PegeCosINB(port)

#elif defined (PEG_PHARLAP)
#include <embclib.h>
#include <conio.h>
#define POUTB(a, b) outp(a, b)
#define PINB(a) inp(a)

#else

// PUT YOUR COMPILER DEFINITION HERE
#define POUTB(a, b) outp(a, b)
#define PINB(a) inp(a)

#endif

#if (PEG_NUM_COLORS == 2)
#define PEG_INCLUDE_MONO_COLOR_TABLE
#elif (PEG_NUM_COLORS == 4)
#define PEG_INCLUDE_4_GRAY_COLOR_TABLE
#elif (PEG_NUM_COLORS > 4)
#define PEG_INCLUDE_DEFAULT_COLOR_TABLE
#endif


/*--------------------------------------------------------------------------*/
// PEG_MULTITHREAD- This definitions instructs PEG to invoke the resource
// protection and message queue management macros needed to support having
// multiple tasks directly interact with the GUI. This definition is turned
// on by default for the in-house integrations, and turned off otherwise. If
// you have ported to a new RTOS and you support the resource protection
// macros, you can turn this on if you want to support the multithread model.
/*--------------------------------------------------------------------------*/
#if defined(PEG_PHARLAP) || defined(PEGX) || defined(PEGSMX) || defined(PEGONTIME)

#define PEG_MULTITHREAD      // This is used when building PEG with one
                             // of the multitasking RTOS kernals. Refer
                             // to the user's manual for additional
                             // information. This define has no effect unless
                             // you are running PEG with an RTOS that has
                             // been fully integrated, and should be disabled
                             // for stand-alone operation.

#elif defined(PEGRTXC) || defined(PEG_PPI) || defined(PEGTRONTASK)

#define PEG_MULTITHREAD

#elif defined(PEG_OSE) || defined(PEGNUCLEUS) || defined(PEGMQX)

#define PEG_MULTITHREAD

#elif defined(PEG_RTX)

#define PEG_MULTITHREAD

#elif defined(PEGUCOS) || defined(PEG_ITRON) || defined(PEG_TKERNEL) || defined(PEGINTEGRITY)

#define PEG_MULTITHREAD

#elif defined(PEGX11) && !defined(PEG_X11NETBSD)

#define PEG_MULTITHREAD

#elif defined(SOLARISPEG) || defined(LINUXPEG) || defined(LYNXPEG)

#define PEG_MULTITHREAD

#elif defined(NETBSDPEG) || defined(PEG_QUADROS) || defined(ECOSPEG)

#define PEG_MULTITHREAD

#elif defined(PEGCMX) || defined(PEGVDK) || defined (PEG_VXWORKS)

#define PEG_MULTITHREAD

#elif defined(PEGOS20)

#define PEG_MULTITHREAD

#elif defined(PEGWIN32)

//#define PEG_MULTITHREAD   // Win32 port can run single or multi-threaded

#elif defined(PEGWINCE)

//#define PEG_MULTITHREAD

#else
//#define PEG_MULTITHREAD   // usually not defined unless custom integration
#endif

/*--------------------------------------------------------------------------*/
// The PegMessageQueue class member functions are often re-implemented
// by Swell Software as part of the RTOS integration module. Your RTOS
// integration notes will tell you if the PEG mesage queue has been
// re-implemented using RTOS services. The definition
// PEG_STANDALONE_MESSAGE_QUEUE turns on the default class member functions
// provided in the module pmessage.cpp. This should be turned on for Win32
// single-threaded, turned on for DOS builds, and turned on for all
// standalone builds.
//
// For most RTOS integrations, this should be turned off.
/*--------------------------------------------------------------------------*/

#if defined(PEGSTANDALONE)

#define PEG_STANDALONE_MESSAGE_QUEUE

#elif defined(PEGWIN32) && !defined(PEG_MULTITHREAD)

#define PEG_STANDALONE_MESSAGE_QUEUE

#elif defined(PEGWINCE) || defined(PEG_EFI)

#define PEG_STANDALONE_MESSAGE_QUEUE

#elif defined(PEGX11) && !defined(PEG_MULTITHREAD)

#define PEG_STANDALONE_MESSAGE_QUEUE

#elif defined(POSIXPEG) && !defined(PEG_MULTITHREAD)

#define PEG_STANDALONE_MESSAGE_QUEUE

#endif

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// A few checks to make sure the filesystem, if any, is configured properly.
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

#if (defined(PEG_PIC_FILE_MODE) || defined(PEG_JPG_VIRTUAL_MEMORY)) && \
    !defined(PEG_FILE_CLASS)
#error "Some of the selected options need a file system."
#endif

#if defined(PEG_FILE_CLASS)
#if (defined(PEG_FILE_ANSI_C) && defined(PEG_FILE_WIN32)) || \
    (defined(PEG_FILE_ANSI_C) && defined(PEG_FILE_FILEX)) || \
    (defined(PEG_FILE_ANSI_C) && defined(PEG_FILE_POSIX)) || \
    (defined(PEG_FILE_WIN32) && defined(PEG_FILE_FILEX)) || \
    (defined(PEG_FILE_WIN32) && defined(PEG_FILE_POSIX)) || \
    (defined(PEG_FILE_FILEX) && defined(PEG_FILE_POSIX))
#error "More than 1 file system interface was selected."
#endif
#endif  // PEG_FILE_CLASS

/*--------------------------------------------------------------------------*/
// the following disables the warning caused with the Borland compiler
// running in 32-bit mode with PEG's use of 16-bit variables.
/*--------------------------------------------------------------------------*/

#if defined(__BORLANDC__) && defined(__WIN32__)  // (if BC 32-bit compiler)
#pragma warn -sig   // Disables warning "Conversion may lose significant digits"
                    // Occurs often due to use of 16-bit variables in calculations.
#endif

/*--------------------------------------------------------------------------*/
// check for invalid build settings for X11 environment
/*--------------------------------------------------------------------------*/
#if defined(PEG_BUILD_PRESC) && defined(PEGX11)
#error PEGX11 is not a valid target when building PEG for PRESC
#endif

/*--------------------------------------------------------------------------*/
// re-define NULL if building for Quadros with MetroWerks
/*--------------------------------------------------------------------------*/
#if defined(PEG_QUADROS)
#undef NULL
#define NULL 0
#endif



/*--------------------------------------------------------------------------*/

#if !defined(PEGSMX)  // use smx's ltoa macro instead
#if defined(__BORLANDC__) && !defined(USE_PEG_LTOA)
#define _ltoa(a, b, c)  ltoa(a, b, c)
#else
#define ltoa(a, b, c)   _ltoa(a, b, c)
#endif   // BORLANDC?
#endif   // PEGSMX

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
// Unique includes and definitions pulled in for each target platform.
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------*/
// Begin system includes for target builds
/*--------------------------------------------------------------------------*/
#if defined(PEGSMX)   // building for SMX?

#if !defined(SMX_H_)
#include "smx.h"
#endif

#if defined(PEGWIN32) // also building for smxSim?

// For smxSim, we want just about everything turned on. These lines
// override the settings in pconfig.hpp, so that building the smxSim
// version of the library is automatic.

#include "windows.h"

#undef  PSCREEN
#define PSCREEN "w32scrn.hpp"  // Win32 screen driver
#define PEG_FULL_GRAPHICS
#undef  PEG_NUM_COLORS
#define PEG_NUM_COLORS   256
#ifdef  PEG_FP_GRAPHICS
#undef  PEG_FP_GRAPHICS
#endif
#define PEG_IMAGE_CONVERT
#define PEG_VECTOR_FONTS
#define PEG_MULTITHREAD

#endif

#elif defined(PEGX)          // building for ThreadX?

#ifndef TX_API
#include "tx_api.h"
#endif

#elif defined(PEG_PHARLAP)

#ifndef _WINDOWS_
#include "windows.h"
#endif

#if defined(PEGTNT)
#include "tntapi.h"
#endif

#elif defined(PEGRTXC) || defined(PEG_QUADROS) || defined(PEG_PPI)

extern "C" {
#include "rtxcapi.h"
}

#elif defined(PEG_RTX)
#include <rtl.h>

#elif defined(PEG_OSE)

#if defined(PEGWIN32)                // building for OSE Softkernal?
#ifndef _WINDOWS_
#include "windows.h"
#endif
#endif

#include "ose.h"

#elif defined(PEGNUCLEUS)           // building for Nucleus Plus?

#include "plus/nucleus.h"                // include Nucleus Plus header files.

#if defined(PEGWIN32)               // also building for NT prototype system?
#ifndef _WINDOWS_
#include "windows.h"
#endif
#endif

#elif defined(_KWIKPEG_)            // building for AMX?

#if defined(KPP_OS_TAPS)
#ifdef PEG_STANDALONE_MESSAGE_QUEUE
#undef PEG_STANDALONE_MESSAGE_QUEUE
#endif
#endif

#elif defined(KWIKPEG)

#include "cjzzz.h"

#elif defined(PEGMQX)                // building for Precise/MQX

#include "mqx.h"
#include "mutex.h"
#include "message.h"
#include "timer.h"

#if defined(PEGWIN32)                // building for Precise/MQX Win32x86
#ifndef _WINDOWS_
#include "windows.h"
#endif
#endif

#elif defined(PEG_VXWORKS)

#include "taskLib.h"
#include "semLib.h"
#include "logLib.h"
#include "wdLib.h"
#include "MsgQLib.h"
#include "sysLib.h"

#elif defined(PEG_FRTOS)            // Building for FreeRTOS

#ifdef PEGWIN32
#undef PEG_STANDALONE_MESSAGE_QUEUE
#endif

extern  "C" {
#define TASKS_C
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
}

#elif defined(PEGWIN32)             // building for Win32 standalone

#ifndef _WINDOWS_
#include "windows.h"
#endif

/*---------------------------------------------------------------------------*/
// Define this if you want a report of memory leaks during program termination.
/*---------------------------------------------------------------------------*/
#if defined(_DEBUG)
#define REPORT_MEMORY_LEAKS
#endif

#if defined REPORT_MEMORY_LEAKS

#include "stdlib.h"
#include "crtdbg.h"
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif


#elif defined(PEGWINCE)

#ifndef _WINDOWS_
#include "windows.h"
#endif

#elif defined(PEGX11)                // building for X11

#if defined(PEG_MULTITHREAD)
#include <pthread.h>
#endif  // PEG_MULTITHREAD

#include <X11/Xlib.h>
#include <X11/Xutil.h>

#ifdef PEG_BUILD_PRESS
#include <sys/types.h>              // for fd_set types
#endif

#if defined(PEG_X11LYNX)                // for message queue support under LynxOS
#include <mqueue.h>
#endif

#elif defined(LINUXPEG)             // building for Linux

#if defined(PEG_MULTITHREAD)
#include <pthread.h>
#endif  // PEG_MULTITHREAD

#include <sys/io.h>

#ifdef PEG_BUILD_PRESS
#include <sys/types.h>              // for fd_set types
#endif

#elif defined(NETBSDPEG)            // building for NetBSD

#include <pthread.h>

#elif defined(LYNXPEG)              // building for LynxOS

#include <pthread.h>
#include <mqueue.h>

#elif defined(SOLARISPEG)           // building for Solaris

#include <pthread.h>

#elif defined(ECOSPEG)              // building for eCos

#include <cyg/kernel/kapi.h>

#elif defined(PEGCMX)               // building for CMX-RTX

extern "C" {
#include "cxfuncs.h"
#include "cxextern.h"
};

#elif defined(PEGVDK)               // building for ADI's VDK

#pragma diag(push)
#pragma diag(suppress: 177,401,451,826,831,1462)
#include "VDK.h"
#pragma diag(pop)

#elif defined(PEGINTEGRITY)         // Building for GHS INTEGRITY

#include <INTEGRITY.h>

#elif defined(PEG_EFI)              // Building for Intel EFI environment?

#include "efi.h"

#endif

/*--------------------------------------------------------------------------*/
// End system includes for target builds
/*--------------------------------------------------------------------------*/

#define NUM_PEG_FREE_MSGS   40     // how many messages are available

/*--------------------------------------------------------------------------*/
// Begin PEG integration includes for target builds
/*--------------------------------------------------------------------------*/
#if defined(PEGSMX)                // building for SMX?

#if defined(PEGWIN32)              // building for smxSim
#include "smxpegw.hpp"
#elif defined(PEG_MULTITHREAD)
#include "smxpegmt.hpp"            // SMX MULTITHREAD header
#else
#include "smxpeg.hpp"              // SMX GRAPHICS_SERVER header
#endif

#elif defined(PEGX)                // building for ThreadX?

#if defined(PEGWIN32)
#include "thxpegw.hpp"               // building for the Win32 development platform
#else
#include "thxpeg.hpp"              // bring in ThreadX integration header
#endif

#elif defined(_KWIKPEG_)

// building for AMX, do nothing


#elif defined(KWIKPEG)

#include "kwikpeg.hpp"

#elif defined(PEG_PHARLAP)             // building for PharLap ETS?

#if defined(PEGTNT)
#include "tntapi.h"                // bring in the TNT integration header
#include "tntpeg.hpp"
#else
#include "etspeg.hpp"              // bring in ETS integration header
#endif

#elif defined(PEG_RTX)

#include "artxpeg.hpp"

#elif defined(QNXPEG)              // building for QNX?

#include "qnxpeg.hpp"              // bring in QNX integration header

#elif defined(LYNXPEG)              // building for LynxOS
#include "lynxpeg.hpp"

#elif defined(LINUXPEG)                // building for Linux
#include "linuxpeg.hpp"

#elif defined(NETBSDPEG)            // building for NetBSD
#include "nbsdpeg.hpp"

#elif defined(SOLARISPEG)           // building for Solaris
#include "solpeg.hpp"

#elif defined(ECOSPEG)             // building for eCos

#include "ecospeg.hpp"

#elif defined(PEGCMX)               // building for CMX-RTX

#include "cmxpeg.hpp"

#elif defined(PEGVDK)               // building for ADI's VDK

#include "vdkpeg.hpp"

#elif defined(PEGRTXC)             // building for RTXC??

#include "rtxcpeg.hpp"             // bring in RTXC integration header

#elif defined(PEG_PPI)

#include "prtxcpeg.hpp"            // custom rtxc integration

#elif defined(PEG_QUADROS)          // building for Quadros?

#include "quadpeg.hpp"              // bring in Quadros header

#elif defined(PEG_OSE)

#include "osepeg.hpp"              // bring in OSE integration header

#elif defined(PEG_ITRON)           // building for ITRON based RTOS

extern "C" {
#include "itron.h"                 // bring in iton.h header
}

#include "itronpeg.hpp"            // and integration header

#elif defined(PEG_TKERNEL)        // building for eSOL PrKernel?

extern "C" {
#include <basic.h>
#include <tk/tkernel.h>
#include <tm/tmonitor.h>

}

#include "tkrnpeg.hpp"              // and integration header

#elif defined(PEGOS20)             // building for ST-Micro's OS20

#include "pegos20.hpp"

#elif defined(PEGNUCLEUS)          // building for Nucleus Plus?

#if defined(PEGWIN32)
#include "nucpegnt.hpp"            // building for NT prototype system?
#else
#include "nuclpeg.hpp"              // default: building for embedded target
#endif

#elif defined(PEGMQX)               // building for Precise/MQX

#if defined(PEGWIN32)
#include "mqxpegmt.hpp"               // building for Win32x86 BSP
#else
#include "mqxpeg.hpp"               // building for target
#endif

#elif defined(PEGUCOS)                // building for uC/OS

#include "ucos_ii.h"
#include "ucospeg.hpp"

#elif defined(PEGPSOS)                // building for pSOS

#include "psospeg.hpp"

#elif defined(PEGX11)               // building for X11

#include "rtos/x11peg.hpp"

#elif defined(PEGINTEGRITY)         // Building for GHS INTEGRITY

#include "intgypeg.hpp"

#elif defined(PEGONTIME)

#include "otpeg.hpp"                // building for On Time RTOS-32

#elif defined(PEG_VXWORKS)          // building for WindRiver VxWorks

#include "vxpeg.hpp"

#elif defined(PEG_FRTOS)            // building for FreeRTOS

 #if defined(PEGWIN32)
  #include "rtos/frtospegw.hpp"     // Windows Version
  #include "windows.h"
#else
  #include "rtos/frtospeg.hpp"
 #endif

#elif defined(PEGWIN32) || defined(PEGWINCE)

#include "rtos\winpeg.hpp"

#else                              // building standalone...

#define LOCK_PEG
#define UNLOCK_PEG
#define LOCK_MESSAGE_QUEUE
#define UNLOCK_MESSAGE_QUEUE
#define LOCK_TIMER_LIST
#define UNLOCK_TIMER_LIST
#define ENQUEUE_TASK_MESSAGE(a, b)
#define PEG_DELAY(a)

#if defined(_MSC_VER) && defined(_DEBUG) && !defined(IBM_JAVA_SUPPORT)
 #include "crtdbg.h"
 #define new new(_NORMAL_BLOCK,__FILE__, __LINE__)
#endif

#endif
/*--------------------------------------------------------------------------*/
// End PEG integration includes for target builds
/*--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------*/
// If building with Bitstream's font fusion rendering support
/*--------------------------------------------------------------------------*/
#if defined(PEG_BITSTREAM)
#include "t2k.h"
#include "cachemgr.h"
#endif
/*--------------------------------------------------------------------------*/
#if !defined(PEG_IMAGE_CONVERT)

#if defined(PEG_BMP_CONVERT) || defined(PEG_GIF_CONVERT)
#define PEG_IMAGE_CONVERT
#elif defined(PEG_PNG_DECODER) || defined(PEG_JPG_CONVERT)
#define PEG_IMAGE_CONVERT
#endif
#endif

#include "pegtypes.hpp"
#include "usertype.hpp"
#ifdef PEG_FILE_CLASS
#include "pfile.hpp"
#endif

#if defined(PEG_RUNTIME_RESOURCES) || defined(WINDOW_BUILDER)
#include "presfile.hpp"
#endif

#include "pegfpm.hpp"
#include "pegerr.hpp"
#include "ptimer.hpp"
#include "pbrush.hpp"
#include "pliteral.hpp"
#include "pegkeys.hpp"
#include "pfonts.hpp"
#include "prect.hpp"

#if defined(PEG_PRO)
#include "peggrad.hpp"
#endif

#if defined(WINDOW_BUILDER)
#if defined(PEGWIN32)
#include "..\..\wb\include\wbresmgr.hpp"
#else
#include "wbresmgr.hpp"
#endif
#else
#include "presmgr.hpp"
#endif

#include "pcapture.hpp"
#include "pmessage.hpp"

#if defined(PEG_BITSTREAM)
#include "pbitstrm.hpp"
#endif

#include "pscreen.hpp"

#if defined(PSCREEN) && !defined(PEG_BUILD_PRESC)
#include PSCREEN                // user code does not need direct driver access
#endif

#include "pinputdev.hpp"

#if defined(PEG_VECTOR_FONTS)
#include "pvecfont.hpp"
#endif

#if defined(PEG_PRINTER_SUPPORT)
#include "pprinter.hpp"
#include PEG_PRINTER
#endif

#include "pthing.hpp"
#include "ptxtthng.hpp"

#include "picon.hpp"

#include "pbutton.hpp"
#if defined(PEG_PRO)
#include "pbmprot.hpp"
#endif
#include "pmltbtn.hpp"
#include "pdecbtn.hpp"
#include "pbdecbtn.hpp"
#include "ptoolbar.hpp"
#include "pgroup.hpp"
#include "pslider.hpp"
#include "pscroll.hpp"
#include "pspin.hpp"
#include "pprogbar.hpp"
#include "pprompt.hpp"
#include "pbprompt.hpp"
#include "psprompt.hpp"
#include "pvprompt.hpp"
#include "panimate.hpp"
#include "paniprmt.hpp"
#include "phelpbtn.hpp"
#include "pstatbar.hpp"
#include "pwindow.hpp"
#include "pmenu.hpp"
#include "ptitle.hpp"
#include "ptable.hpp"
#include "pspread.hpp"
#include "panimwin.hpp"
#include "pnotebk.hpp"
#include "ptree.hpp"

#include "ppresent.hpp"
#include "peditfld.hpp"
#if defined(PEG_BIDI_SUPPORT)
#include "pbdedfld.hpp"
#endif
#include "plist.hpp"
#include "pvvlist.hpp"
#include "pcombo.hpp"
#include "ptextbox.hpp"
#include "peditbox.hpp"
#include "pdecwin.hpp"
#include "pdialog.hpp"
#include "pmesgwin.hpp"
#include "pmlmsgwn.hpp"
#include "pprogwin.hpp"
#include "ppwdfld.hpp"

#if defined(PEG_RICH_TEXT_SUPPORT)
#include "prichtextbox.hpp"
#endif

#if defined(PEG_HMI_GADGETS) || defined(PEG_FULL_GRAPHICS) || \
    defined(PEG_ARC_GRAPHICS)
#include "psincos.hpp"
#endif

#include "p2dpoly.hpp"

#ifdef PEG_CHARTING

#include "pchart.hpp"
#include "plnchart.hpp"
#include "pmlchart.hpp"
#include "pstchart.hpp"

#endif

#ifdef PEG_HMI_GADGETS

#include "pdial.hpp"
#include "pfdial.hpp"
#include "pcdial.hpp"
#include "pfbdial.hpp"
#include "pcbdial.hpp"

#endif
#include "TransparentBitmapWindow.hpp"
#include "TransparentSelectPrompt.hpp"

#ifdef PEG_FILE_DIALOG
#include "pfdialog.hpp"
#endif

#ifdef PEG_DIR_BROWSER
#include "pdirbwr.hpp"
#endif

#if defined(PEG_TOUCH_SUPPORT)
#include "ptouchdev.hpp"
#ifdef PEG_TOUCH_INCLUDE
 #include PEG_TOUCH_INCLUDE
#endif
#endif  // PEG_TOUCH_SUPPORT

#if defined(PEG_KEYBOARD_SUPPORT)
#include "pkeybddev.hpp"
#ifdef PEG_KEYBOARD_INCLUDE
 #include PEG_KEYBOARD_INCLUDE
#endif
#endif  // PEG_KEYBOARD_SUPPORT

#if defined(PEG_MOUSE_SUPPORT)
#include "pmousedev.hpp"
#ifdef PEG_MOUSE_INCLUDE
 #include PEG_MOUSE_INCLUDE
#endif
#endif  // PEG_MOUSE_INCLUDE

#if defined(PEG_MISC_SUPPORT) && defined(PEG_MISC_INCLUDE)
 #include PEG_MISC_INCLUDE
#endif //defined(PEG_MISC_SUPPORT) && defined(PEG_MISC_INCLUDE)

/*--------------------------------------------------------------------------*/
// Check for needing PEG_ZIP and/or PEG_UNZIP for PNG encoding or decoding
/*--------------------------------------------------------------------------*/
#if !defined(PEG_ZIP)
#if defined(PEG_PNG_ENCODER)
#define PEG_ZIP
#endif
#endif

#if !defined(PEG_UNZIP)
#if defined(PEG_PNG_DECODER)
#define PEG_UNZIP
#endif
#endif

#if defined(PEG_ZIP) || defined(PEG_UNZIP)
#include "pzip.hpp"
#endif

#if defined(PEG_JPG_HW_CONVERT) || defined(PEG_PNG_HW_CONVERT) || defined(PEG_GIF_HW_CONVERT)
#define PEG_HW_IMAGE_DECODER
#endif

#if defined(PEG_IMAGE_CONVERT)
#include "pimgconv.hpp"

#if defined(PEG_QUANT)
#include "pquant.hpp"
#endif

#if defined(PEG_GIF_CONVERT)
#include "pgifconv.hpp"
#endif

#if defined(PEG_BMP_CONVERT)
#include "pbmpconv.hpp"
#endif

#if defined(PEG_JPG_CONVERT)
#include "pjpgconv.hpp"
#endif

#if defined(PEG_JPG_HW_CONVERT)
#include "pjpghwconv.hpp"
#endif

#if defined(PEG_PNG_ENCODER) || defined(PEG_PNG_DECODER)
#include "ppngconv.hpp"
#endif

#endif      // PEG_IMAGE_CONVERT if

/*--------------------------------------------------------------------------*/
// Building the Peg REmote Screen Server
/*--------------------------------------------------------------------------*/
#ifdef PEG_BUILD_PRESS

#include "pressdef.hpp"
#include "pressmsg.hpp"
#include "pressres.hpp"
#include "press.hpp"

#endif

/*--------------------------------------------------------------------------*/
// Building a Peg REmote Screen Client
/*--------------------------------------------------------------------------*/
#ifdef PEG_BUILD_PRESC

#include "pressdef.hpp"
#include "pressmsg.hpp"
#include "pressres.hpp"
#include "prescpm.hpp"
#include "prescscr.hpp"

#endif

/*--------------------------------------------------------------------------*/
// Opera web browser support
/*--------------------------------------------------------------------------*/
#if defined(PEG_OPERA_SUPPORT)
// just put this here for the time being
#include "pmutex.hpp"
#include "pdatalist.hpp"

#include "gogi_opera_api.h"
#include "pgogi_screen_data.hpp"
#include "pgogi_window_data.hpp"
#include "pgogi_invalid_screen_data.hpp"
#include "pgogi_event_queue.hpp"
#include "ppeg_event_queue.hpp"
#include "pgogi.hpp"
#include "poperawin.hpp"
#endif  // PEG_OPERA_SUPPORT


#if defined(PEG_PHARLAP)

#if defined(PEGTNT)
PegPresentationManager *TntGUIPresentation(void);
#else
PegPresentationManager *EtsGUIPresentation(void);
#endif

#endif

/*--------------------------------------------------------------------------*/

void PegCreateFramework(const PegRect &Size);
void PegDestroyFramework(void);

/*--------------------------------------------------------------------------*/

#if defined(_KWIKPEG_)          // building for KADAK AMX?
#if defined(PEG_FILE_PERMIT)    // need file I/O?
#include "kp_files.h"
#endif
#endif

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#if defined(PEGWIN32)

typedef struct {
    PEGINT xScreenSize;
    PEGINT yScreenSize;
    PEGINT xWinClientSize;
    PEGINT yWinClientSize;
    PEGINT xOffset;
    PEGINT yOffset;
    HBITMAP SkinBitmap;
    char   Raw[300];
} CommandLineParams;

#elif defined(PEGX11)

typedef struct {
    PEGINT xScreenSize;
    PEGINT yScreenSize;
    PEGINT xWinClientSize;
    PEGINT yWinClientSize;
    PEGINT xOffset;
    PEGINT yOffset;
    XImage *SkinBitmap;
    char   Raw[300];
} CommandLineParams;

#elif defined(LINUXPEG)

typedef struct {
    char   mouseEvDev[256];
    char   touchEvDev[256];
    char   keybdEvDev[256];
    char   miscEvDev[256];
    char   Raw[300];
} CommandLineParams;

extern CommandLineParams CommandLine;

#endif


/*--------------------------------------------------------------------------*/


#endif   // _PEGDEFS_



